﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Controls_ucFooter : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //Get Partners
        Dal.arParams.Clear();
        Dal.arParams.Add(0); // Partners information
        DataTable DT = Dal.ExecuteDBsp("usp_GetFooterLinksByType", Dal.arParams);
        if(DT!=null)
            if(DT.Rows.Count>0)
                foreach (DataRow dr in DT.Rows)
                {
                    string sText = string.Format("<li><a href=\"{0}\" target=\"_blank\">{1}</a></li>", (dr["LinkURL"].ToString().Contains("http://")) ? dr["LinkURL"].ToString() : "http://" + dr["LinkURL"].ToString(), dr["LinkText"]);
                    ulPartners.InnerHtml += sText;
                }
        
        //Get links
        Dal.arParams.Clear();
        Dal.arParams.Add(1); // Partners information
        DT = Dal.ExecuteDBsp("usp_GetFooterLinksByType", Dal.arParams);
        if (DT != null)
            if (DT.Rows.Count > 0)
                foreach (DataRow dr in DT.Rows)
                {
                    string sText = string.Format("<li><a href=\"{0}\" target=\"_blank\">{1}</a></li>", (dr["LinkURL"].ToString().Contains("http://")) ? dr["LinkURL"].ToString() :"http://"+ dr["LinkURL"].ToString(), dr["LinkText"]);
                    ulLinks.InnerHtml += sText;
                }

        // GetInformation
        DT = Dal.ExecuteDBsp("usp_GetInformation");
        if (DT != null)
            if (DT.Rows.Count > 0)
            {
                divInfo.InnerHtml += DT.Rows[0]["Context"].ToString();
                divCopyright.InnerHtml+= DT.Rows[1]["Context"].ToString();
            }
    }
}
